package org.shuma.goods.domain.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

/**
 * @TableName product_basic_info
 */
@TableName(value = "product_basic_info")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ProductBasicInfo implements Serializable {
    /**
     * 商品id
     */
    @TableId
    private Long productId;

    /**
     * 商品类型id
     */
    private Long productTypeId;

    /**
     * (外键）商品详情id
     */
    @TableField(exist = false)
    private Long pDetailsId;

    /**
     * 外键）供应商id
     */
    private Long productSupplier;

    /**
     * 店小二操作的状态(包括已编辑,已提交审核)
     */
    private Integer productOwnerState;

    /**
     * 商品的审核以及上线状态
     * 未审核 - 0
     * 审核通过 - 1
     * 审核驳回 - 2
     * 未上线 - 3
     * 已上线 - 4
     * 已下线 - 5
     * 草稿  - 6
     */
    private Integer productCheckState;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 修改时间
     */
    private Date updateTime;

    /**
     * 管理人
     */
    private Long operator;

    /**
     * 备注
     */
    private String remark;

    /**
     * 代理人
     */
    private Long proxyId;

    /**
     * 是否删除
     * 0 - 不删除
     */
    private Integer isDelete;

    /**
     * 创建人
     */
    private Long creator;

    /**
     * 商品名称
     */
    private String productName;

    /**
     * 库存
     */
    private Integer stock;

    /**
     * 上线时间
     */
    private Date timeOn;

    /**
     * 下线时间
     */
    private Date timeOff;

    /**
     * 权益id
     */
    private Long raiId;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        ProductBasicInfo other = (ProductBasicInfo) that;
        return (this.getProductId() == null ? other.getProductId() == null : this.getProductId().equals(other.getProductId()))
                && (this.getProductTypeId() == null ? other.getProductTypeId() == null : this.getProductTypeId().equals(other.getProductTypeId()))
                && (this.getPDetailsId() == null ? other.getPDetailsId() == null : this.getPDetailsId().equals(other.getPDetailsId()))
                && (this.getProductSupplier() == null ? other.getProductSupplier() == null : this.getProductSupplier().equals(other.getProductSupplier()))
                && (this.getProductOwnerState() == null ? other.getProductOwnerState() == null : this.getProductOwnerState().equals(other.getProductOwnerState()))
                && (this.getProductCheckState() == null ? other.getProductCheckState() == null : this.getProductCheckState().equals(other.getProductCheckState()))
                && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
                && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
                && (this.getOperator() == null ? other.getOperator() == null : this.getOperator().equals(other.getOperator()))
                && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()))
                && (this.getProxyId() == null ? other.getProxyId() == null : this.getProxyId().equals(other.getProxyId()))
                && (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete()))
                && (this.getCreator() == null ? other.getCreator() == null : this.getCreator().equals(other.getCreator()))
                && (this.getProductName() == null ? other.getProductName() == null : this.getProductName().equals(other.getProductName()))
                && (this.getStock() == null ? other.getStock() == null : this.getStock().equals(other.getStock()))
                && (this.getTimeOn() == null ? other.getTimeOn() == null : this.getTimeOn().equals(other.getTimeOn()))
                && (this.getTimeOff() == null ? other.getTimeOff() == null : this.getTimeOff().equals(other.getTimeOff()))
                && (this.getRaiId() == null ? other.getRaiId() == null : this.getRaiId().equals(other.getRaiId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getProductId() == null) ? 0 : getProductId().hashCode());
        result = prime * result + ((getProductTypeId() == null) ? 0 : getProductTypeId().hashCode());
        result = prime * result + ((getPDetailsId() == null) ? 0 : getPDetailsId().hashCode());
        result = prime * result + ((getProductSupplier() == null) ? 0 : getProductSupplier().hashCode());
        result = prime * result + ((getProductOwnerState() == null) ? 0 : getProductOwnerState().hashCode());
        result = prime * result + ((getProductCheckState() == null) ? 0 : getProductCheckState().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        result = prime * result + ((getOperator() == null) ? 0 : getOperator().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        result = prime * result + ((getProxyId() == null) ? 0 : getProxyId().hashCode());
        result = prime * result + ((getIsDelete() == null) ? 0 : getIsDelete().hashCode());
        result = prime * result + ((getCreator() == null) ? 0 : getCreator().hashCode());
        result = prime * result + ((getProductName() == null) ? 0 : getProductName().hashCode());
        result = prime * result + ((getStock() == null) ? 0 : getStock().hashCode());
        result = prime * result + ((getTimeOn() == null) ? 0 : getTimeOn().hashCode());
        result = prime * result + ((getTimeOff() == null) ? 0 : getTimeOff().hashCode());
        result = prime * result + ((getRaiId() == null) ? 0 : getRaiId().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", productId=").append(productId);
        sb.append(", productTypeId=").append(productTypeId);
        sb.append(", productDetailsId=").append(pDetailsId);
        sb.append(", productSupplier=").append(productSupplier);
        sb.append(", productOwnerState=").append(productOwnerState);
        sb.append(", productCheckState=").append(productCheckState);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", operator=").append(operator);
        sb.append(", remark=").append(remark);
        sb.append(", proxyId=").append(proxyId);
        sb.append(", isDelete=").append(isDelete);
        sb.append(", creator=").append(creator);
        sb.append(", productName=").append(productName);
        sb.append(", stock=").append(stock);
        sb.append(", timeOn=").append(timeOn);
        sb.append(", timeOff=").append(timeOff);
        sb.append(", raiId=").append(raiId);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}